package com.example.petshop.service.impl;

import com.example.petshop.entity.Shop;
import com.example.petshop.mapper.ShopMapper;
import com.example.petshop.service.ShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ShopServiceImpl implements ShopService {
    @Autowired
    private ShopMapper shopMapper;

    @Override
    public Shop getShopById(Integer shopId) {

        return shopMapper.getShopById(shopId);
    }

    @Override
    public void createShop(Shop shop) {
        // 使用ShopMapper插入新的商店记录
        shopMapper.insert(shop);
    }

    @Override
    public void deleteShop(Integer shopId) {
        shopMapper.deleteById(shopId);
    }

    @Override
    public void updateShop(Shop shop) {
        // 使用ShopMapper更新商店记录
        shopMapper.updateShop(shop);
    }

    @Override
    public List<Shop> getAllShops() {
        return shopMapper.getAllShops();
    }

}
